﻿@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model SimpleIdServer.IdServer.UI.ViewModels.BaseAuthenticateViewModel
@using SimpleIdServer.IdServer.ConformanceSuite.Startup.Resources
@using System.Globalization

@{
    Layout = "~/Views/Shared/_CommonLayout.cshtml";
}

<div class="modal login">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="clientinfo">
                @Html.ClientPicture(Model.LogoUri)
            </div>
            @RenderBody()
            <div class="divider">
                <p class="fw-bold text">OR</p>
            </div>
            <div>
                <ul class="extauth">
                    @foreach (var extProvider in Model.ExternalIdsProviders)
                    {
                        <li>
                            <a class="btn btn-secondary"
                           asp-controller="ExternalAuthenticate"
                           asp-area=""
                           asp-action="Login"
                           asp-route-scheme="@extProvider.AuthenticationScheme"
                           asp-route-returnUrl="@Model.ReturnUrl"
                           asp-route-prefix="@Model.Realm">@extProvider.DisplayName</a>
                        </li>
                    }
                </ul>
            </div>
            <div class="footer">
                @if (!string.IsNullOrWhiteSpace(Model.TosUri))
                {
                    <a href="@Model.TosUri" target="_blank">@AuthenticatePasswordResource.tos</a>
                }

                @if (!string.IsNullOrWhiteSpace(Model.PolicyUri))
                {
                    <a href="@Model.PolicyUri" target="_blank">@AuthenticatePasswordResource.policy</a>
                }
            </div>
        </div>
    </div>
</div>

@section Scripts {
    <script type="text/javascript">
        $(document).ready(function () {
            $(".login").modal({
                backdrop: 'static',
                keyboard: true
            });
            $(".login").modal('show');
        });
    </script>
}

@RenderSection("SubScripts", required: false)